From: Jeroen van der Heijden Date: Sat, 6 Oct 2018 10:31:49 +0000 (+0200) Subject: Added version info X-Git-Tag: archive/raspbian/2.0.44-1+rpi1~1^2~3^2~8^2~26 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=464bda1cf27c1ac237c1902d9fb519e7088d6865;p=siridb-server.git Added version info --- diff --git a/itest/testing/args.py b/itest/testing/args.py index da7171de..424f19b1 100644 --- a/itest/testing/args.py +++ b/itest/testing/args.py @@ -3,6 +3,7 @@ import subprocess import argparse from .server import Server from .color import Color +from .constants import SIRIDBC def is_valgrind_installed(): @@ -15,6 +16,26 @@ def is_valgrind_installed(): return True +def print_siridb_version(args): + fn = SIRIDBC.format(BUILDTYPE=args.build) + try: + p = subprocess.Popen( + [fn, '--version'], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + except FileNotFoundError: + print(Color.error(f'Cannot find: {fn}')) + exit(1) + + output, err = p.communicate() + rc = p.returncode + if rc or err: + print(Color.error(f'Cannot use: {fn}')) + exit(1) + + print(f'Test with: {Color.info(output.decode().splitlines()[0])}') + + def parse_args(): parser = argparse.ArgumentParser() @@ -52,6 +73,7 @@ def parse_args(): has_valgrind = is_valgrind_installed() + print_siridb_version(args) print("Test using valgrind for memory errors and leaks: ", end='') if args.mem_check and not has_valgrind: print(Color.warning('disabled (!! valgrind not found !!)')) diff --git a/itest/testing/color.py b/itest/testing/color.py index ff28fe21..729d1191 100644 --- a/itest/testing/color.py +++ b/itest/testing/color.py @@ -3,6 +3,7 @@ NORMAL = '\x1B[0m' RED = '\x1B[31m' GREEN = '\x1B[32m' YELLOW = '\x1B[33m' +LYELLOW = '\x1b[93m' class Color: @@ -19,4 +20,6 @@ class Color: def error(text): return f'{RED}{text}{NORMAL}' - + @staticmethod + def info(text): + return f'{LYELLOW}{text}{NORMAL}' diff --git a/itest/testing/constants.py b/itest/testing/constants.py index e578923e..b4a59329 100644 --- a/itest/testing/constants.py +++ b/itest/testing/constants.py @@ -1,4 +1,3 @@ -BUILDTYPE = 'Debug' TEST_DIR = './testdir' SIRIDBC = '../{BUILDTYPE}/siridb-server' ADMIN = '/usr/local/bin/siridb-admin' diff --git a/itest/testing/server.py b/itest/testing/server.py index 2b9b4b31..a641207c 100644 --- a/itest/testing/server.py +++ b/itest/testing/server.py @@ -10,7 +10,6 @@ import platform from .constants import SIRIDBC from .constants import TEST_DIR from .constants import VALGRIND -from .constants import BUILDTYPE from .constants import MAX_OPEN_FILES MEM_PROC = \ @@ -22,7 +21,7 @@ class Server: HOLD_TERM = False GEOMETRY = '140x60' MEM_CHECK = False - BUILDTYPE = BUILDTYPE + BUILDTYPE = 'Release' SERVER_ADDRESS = '%HOSTNAME' IP_SUPPORT = 'ALL' TERMINAL = None # one of [ 'XTERM', 'XFCE4_TERMINAL', None ]